#include <reg52.h>
#include "intrins.h"

sbit KEY1 = P3 ^ 1;
sbit KEY2 = P3 ^ 0;
sbit KEY3 = P3 ^ 2;
sbit KEY4 = P3 ^ 3;

sbit LED1 = P2^0;
sbit LED2 = P2^1;
sbit LED3 = P2^2;
sbit LED4 = P2^3;

int ledStatus[] = {1,1,1,1};
int delay_10us(int us){
	while(us--);
	return 1;
}
int main() {
    while (1) {
		if(KEY1 == 0){
			ledStatus[0] = !ledStatus[0];
		}
        if (KEY2 == 0) {
            ledStatus[1] = !ledStatus[1];
        }
        if(KEY3 == 0){
			ledStatus[2] = !ledStatus[2];
        }
        if(KEY4 == 0){
			ledStatus[3] = !ledStatus[3];
		}
        LED1 = ledStatus[0];
        LED2 = ledStatus[1];
        LED3 = ledStatus[2];
        LED4 = ledStatus[3];
		delay_10us(1000);
    }
    return 0;
}